<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{ padding: 0; margin: 0; list-style-type: none; box-sizing: border-box;}
        .cont{ width: 100vw; height: 100vh;}
        .cont aside{ width: 200px; background: blue; position: fixed; left: 0; top:0; bottom: 0; transition: all 1s;}
        .cont main{ width: 100%; height: 100%; padding-left: 200px; overflow: auto; background-color: aliceblue; transition: all 1s;}
        .cont main header{ height: 80px; background-color: aqua;}
        .cont main section{background-color: antiquewhite; width: 100%; height: calc( 100% - 80px ); overflow-y: scroll;}
        .aside{ width: 50px!important;}
        .seone{ height: 5000px; background-color: green;}
    </style>
</head>
<body>
    <div class="cont">
         <aside id="aside"></aside>
         <main id="main">
             <header><button id="guanbi">关闭</button></header>
             <section>
                <div class="seone"></div>
             </section>
         </main>
    </div>
    <script>
        let cont = document.querySelector('.cont');
        let main = document.querySelector('#main');
        let guanbi = document.querySelector('#guanbi');
        let aside = document.querySelector('#aside');
        guanbi.onclick = function(){
            aside.classList.toggle('aside');
            if(aside.classList.contains('aside')){
                main.style.paddingLeft = 50 + 'px';
            }else{
                main.style.paddingLeft = 200 + 'px';
            }
        }
    </script>
</body>
</html>